import javax.jws.WebService;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;

@WebServlet("/Product")
public class Product extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session=req.getSession();
        session.setAttribute("session","SESSION");
        HashMap<String,String> map=new HashMap<>();
        map.put("china","中国");
        map.put("america","美国");
        map.put("england","英国");
        req.setAttribute("map",map);
        req.setAttribute("sb","SB");
        String mame="SB";
        req.setAttribute("name",mame);
        Object[] obj={req.getAuthType(),req.getContextPath(),req.getCookies(),req.getDateHeader("yyyy MM HH hh:mm:ss "),
        req.getHeaderNames(),req.getMethod(),req.getPathInfo(),req.getSession(),"\n",resp.getHeaderNames(),resp.getLocale()};
        req.setAttribute("obj",obj);
        //req.setAttribute("req",req.getPathInfo());
        req.getRequestDispatcher("/Product.jsp").forward(req,resp);
    }
}
